package com.service.impl;

import com.domain.Book;
import com.domain.Log;
import com.entity.PageResult;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.mapper.LogMapper;
import com.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class LogServiceImpl implements LogService {

    @Autowired
    private LogMapper logMapper;

    @Override
    public Integer addLog(Log log) {
        return logMapper.addLogin(log);
    }
//
//    @Override
//    public Integer addLogout(Log log) {
//        return logMapper.addLogout(log);
//    }

    @Override
    public PageResult findAll(int pageNum, int pageSize) {
        //开启分页查询
        PageHelper.startPage(pageNum,pageSize);
        //调用dao
        Page<Log> page=logMapper.findAll();

        return new PageResult(page.getTotal(),page.getResult());
    }
}
